public class Timo {

    public static int findPoisonedDuration(int[] timeSeries, int duration) {
        int res=0;
        int over=0;
        for (int i = 0; i < timeSeries.length; i++) {
            if(over<=timeSeries[i]){
                res+=duration;
            }else{
                res+=1;
            }
            over=res+timeSeries[i];
        }
        return res;
    }

    public static void main(String[] args) {
        int[] a={1,2,3,4,5,6,7,8,9}; int d=2;
        findPoisonedDuration(a,1);
    }
}
